"advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bufstream 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cargotest 0.1.0",
- "crates-io 0.8.0",
+ "crates-io 0.7.0",
"crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"curl 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"docopt 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
]
-[[package]]
-name = "redox_syscall"
-version = "0.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
[[package]]
name = "regex"
version = "0.1.80"
"unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
-[[package]]
-name = "time"
-version = "0.1.36"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
- "redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
[[package]]
name = "toml"
version = "0.2.1"
"checksum quick-error 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0aad603e8d7fb67da22dbdf1f4b826ce8829e406124109e73cf1b2454b93a71c"
"checksum quote 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e7b44fd83db28b83c1c58187159934906e5e955c812e211df413b76b03c909a5"
"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d"
-"checksum redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd35cc9a8bdec562c757e3d43c1526b5c6d2653e23e2315065bc25556550753"
"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f"
"checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01"
"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957"
"checksum thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4437c97558c70d129e40629a5b385b3fb1ffac301e63941335e4d354081ec14a"
"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"
"checksum thread_local 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7793b722f0f77ce716e7f1acf416359ca32ff24d04ffbac4269f44a4a83be05d"
-"checksum time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade"
"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4"
"checksum toml 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08272367dd2e766db3fa38f068067d17aa6a9dfd7259af24b3927db92f1e0c2f"
"checksum unicode-bidi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b61814f3e7fd0e0f15370f767c7c943e08bc2e3214233ae8f88522b334ceb778"
path = "src/cargo/lib.rs"
[dependencies]
-crates-io = { path = "src/crates-io", version = "0.8" }
+crates-io = { path = "src/crates-io", version = "0.7" }
crossbeam = "0.2"
curl = "0.4.6"
docopt = "0.7"
let mut data = BTreeMap::new();
data.insert("name".to_owned(), name.to_owned());
data.insert("author".to_owned(), author);
- data.insert("year".to_owned(), (time::now().tm_year + 1900).to_string());
let template_set = try!(get_input_template(config, opts));
for template in template_set.template_files.iter() {
human(format!("entry is somehow not a subpath \
of the directory being walked."))
})));
- templates.push(Box::new(InputFileTemplateFile::new(entry_path,
+ templates.push(Box::new(InputFileTemplateFile::new(entry_path,
dest_file_name.to_path_buf())));
Ok(())
}));
You can also use your own template to scaffold cargo projects! See the
[Templates](#templates) section for more details.
-
+
Let’s check out what Cargo has generated for us:
```shell
The variables available for use are:
- `name`: the name of the project
-- `author`: the toml formatted name of the project author
-- `year`: the current year
+- `authors`: the toml formatted name of the project author
In the future, more variables may be added. Suggestions welcome!
name = "{{name}}"
version = "0.0.1"
authors = ["{{author}}"]
-"#).unwrap();
-File::create(&root.join("home/.cargo/templates/testtemplate/LICENSE"))
- .unwrap().write_all(br#"
-(c) {{year}} {{author}}
"#).unwrap();
File::create(&root.join("home/.cargo/templates/testtemplate/src/main.rs"))
.unwrap().write_all(br#"
assert_that(&paths::root().join("foo"), existing_dir());
assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
- assert_that(&paths::root().join("foo/LICENSE"), existing_file());
assert_that(&paths::root().join("foo/src/main.rs"), existing_file());
- let license = paths::root().join("foo/LICENSE");
- let mut contents = String::new();
- File::open(&license).unwrap().read_to_string(&mut contents).unwrap();
- let expected = format!("(c) {} {}", (time::now().tm_year + 1900).to_string(), "foo");
- assert!(contents.contains(&expected));
-
assert_that(cargo_process("build").cwd(&paths::root().join("foo")),
execs().with_status(0));
assert_that(&paths::root().join(&format!("foo/target/debug/foo{}",